package com.zds.hj.poseidon.biz.dispatcher.credit.demo;

import com.zds.boot.common.exception.BusinessException;
import com.zds.boot.dispatch.annotation.DispatcherHandler;
import com.zds.boot.dispatch.comm.enums.ModuleNodeTypeEnum;
import com.zds.boot.dispatch.dto.BaseReqModel;
import com.zds.boot.dispatch.dto.BaseResultModel;
import com.zds.boot.dispatch.dto.ModuleBaseInfo;
import com.zds.hj.poseidon.biz.dispatcher.credit.CreditCheckAbsHandler;
import com.zds.hj.poseidon.facade.dto.hpp.credit.CreditInfoEntityDto;
import com.zds.hj.product.facade.constant.ApplicationContainerConstant;
import com.zds.zly.common.enums.HjResultCodeEnum;
import lombok.extern.slf4j.Slf4j;

/**
 * @Author duanhao
 * @Description 个人信息检查
 * @Date 2023/6/6 10:39
 */
@DispatcherHandler(value = "PersonalCheckHandler", desc = "个人信息检查", applicationContainer = ApplicationContainerConstant.FRONT_END, nodeType = ModuleNodeTypeEnum.BUSINESS)
@Slf4j
public class PersonalCheckHandler extends CreditCheckAbsHandler {


    @Override
    public void creditDoExecute(BaseReqModel params, BaseResultModel resultModel, CreditInfoEntityDto reqData, CreditInfoEntityDto dbData) {
        log.info("个人信息检查自动模块");
        // 查询第三方接口
        String name = "张三";
        if (!dbData.getName().equals(name)) {
            throw new BusinessException("身份证姓名不匹配", HjResultCodeEnum.PARAMS_VALIDATE_FAIL.code());
        }
    }

    @Override
    public ModuleBaseInfo moduleBaseInfo() {
        ModuleBaseInfo moduleBaseInfo = super.moduleBaseInfo();
        moduleBaseInfo.setAuto(true);
        return moduleBaseInfo;
    }

}
